Skip to content

Support Romanian ordinal formatting#331

Open
lin-hongkuan wants to merge 1 commit into
python-humanize:mainfrom
lin-hongkuan:codex/romanian-ordinal-format
Open

Support Romanian ordinal formatting#331
lin-hongkuan wants to merge 1 commit into
python-humanize:mainfrom
lin-hongkuan:codex/romanian-ordinal-format

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Fixes #270

Changes proposed in this pull request:

  • Allow ordinal translations to provide a complete value-aware format while preserving the existing suffix-only fallback.
  • Add Romanian ordinal translations for male and female forms, including the special 1 forms and numeric forms such as 21/23.
  • Add regression coverage for Romanian ordinal output.

Validation:

  • bash scripts/generate-translation-binaries.sh
  • python -m pytest -q (776 passed)
  • python -m ruff check .
  • python -m ruff format --check .

@lin-hongkuan

Copy link
Copy Markdown
Author

I do not have permission to add labels on this repository. This should use the changelog: Fixed label for the required PR label workflow.

@hugovk hugovk added the changelog: Fixed For any bug fixes label Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.55%. Comparing base (976484a) to head (78bbb13).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #331   +/-   ##
=======================================
  Coverage   99.55%   99.55%           
=======================================
  Files          12       12           
  Lines         900      905    +5     
=======================================
+ Hits          896      901    +5     
  Misses          4        4           
Flag Coverage Δ
macos-latest 97.56% <100.00%> (+0.01%) ⬆️
ubuntu-latest 97.56% <100.00%> (+0.01%) ⬆️
windows-latest 95.69% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented Jun 25, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 20.68%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 14 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
test_ordinal 51 µs 64.3 µs -20.68%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing lin-hongkuan:codex/romanian-ordinal-format (78bbb13) with main (976484a)

Open in CodSpeed

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexei Please could you check if this works for Romanian?

Comment thread src/humanize/number.py
Comment on lines +112 to +116
ordinal_format = P_(f"ordinal value {value} ({gender})", _ORDINAL_VALUE)
if ordinal_format == _ORDINAL_VALUE:
suffix = P_(f"{digit} ({gender})", _ORDINAL_SUFFIXES[digit])
ordinal_format = P_(f"ordinal {digit} ({gender})", f"{_ORDINAL_VALUE}{suffix}")
return ordinal_format % {"value": value}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain a bit how this works? Any special instructions for the translator?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file only translates src/humanize/number.py, and not the other files. Is that intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Impossible to translate to Romanian

2 participants